home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIServerSocket.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  13KB  |  341 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIServerSocket.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIServerSocket_h__
  6. #define __gen_nsIServerSocket_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIServerSocketListener; /* forward declaration */
  18.  
  19. class nsISocketTransport; /* forward declaration */
  20.  
  21.  
  22. /* starting interface:    nsIServerSocket */
  23. #define NS_ISERVERSOCKET_IID_STR "a5b64be0-d563-46bb-ae95-132e46fcd42f"
  24.  
  25. #define NS_ISERVERSOCKET_IID \
  26.   {0xa5b64be0, 0xd563, 0x46bb, \
  27.     { 0xae, 0x95, 0x13, 0x2e, 0x46, 0xfc, 0xd4, 0x2f }}
  28.  
  29. /**
  30.  * nsIServerSocket
  31.  *
  32.  * An interface to a server socket that can accept incoming connections.
  33.  */
  34. class NS_NO_VTABLE nsIServerSocket : public nsISupports {
  35.  public: 
  36.  
  37.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISERVERSOCKET_IID)
  38.  
  39.   /**
  40.      * init
  41.      *
  42.      * This method initializes a server socket.
  43.      *
  44.      * @param aPort
  45.      *        The port of the server socket.  Pass -1 to indicate no preference,
  46.      *        and a port will be selected automatically.
  47.      * @param aLoopbackOnly
  48.      *        If true, the server socket will only respond to connections on the
  49.      *        local loopback interface.  Otherwise, it will accept connections
  50.      *        from any interface.  To specify a particular network interface,
  51.      *        use initWithAddress.
  52.      * @param aBackLog
  53.      *        The maximum length the queue of pending connections may grow to.
  54.      *        This parameter may be silently limited by the operating system.
  55.      *        Pass -1 to use the default value.
  56.      */
  57.   /* void init (in long aPort, in boolean aLoopbackOnly, in long aBackLog); */
  58.   NS_IMETHOD Init(PRInt32 aPort, PRBool aLoopbackOnly, PRInt32 aBackLog) = 0;
  59.  
  60.   /**
  61.      * initWithAddress
  62.      *
  63.      * This method initializes a server socket, and binds it to a particular
  64.      * local address (and hence a particular local network interface).
  65.      *
  66.      * @param aAddr
  67.      *        The address to which this server socket should be bound.
  68.      * @param aBackLog
  69.      *        The maximum length the queue of pending connections may grow to.
  70.      *        This parameter may be silently limited by the operating system.
  71.      *        Pass -1 to use the default value.
  72.      */
  73.   /* [noscript] void initWithAddress ([const] in PRNetAddrPtr aAddr, in long aBackLog); */
  74.   NS_IMETHOD InitWithAddress(const union PRNetAddr * aAddr, PRInt32 aBackLog) = 0;
  75.  
  76.   /**
  77.      * close
  78.      *
  79.      * This method closes a server socket.  This does not affect already
  80.      * connected client sockets (i.e., the nsISocketTransport instances
  81.      * created from this server socket).  This will cause the onStopListening
  82.      * event to asynchronously fire with a status of NS_BINDING_ABORTED.
  83.      */
  84.   /* void close (); */
  85.   NS_IMETHOD Close(void) = 0;
  86.  
  87.   /**
  88.      * asyncListen
  89.      *
  90.      * This method puts the server socket in the listening state.  It will
  91.      * asynchronously listen for and accept client connections.  The listener
  92.      * will be notified once for each client connection that is accepted.  The
  93.      * listener's onSocketAccepted method will be called on the same thread
  94.      * that called asyncListen (the calling thread must have a nsIEventTarget).
  95.      *
  96.      * The listener will be passed a reference to an already connected socket
  97.      * transport (nsISocketTransport).  See below for more details.
  98.      *
  99.      * @param aListener
  100.      *        The listener to be notified when client connections are accepted.
  101.      */
  102.   /* void asyncListen (in nsIServerSocketListener aListener); */
  103.   NS_IMETHOD AsyncListen(nsIServerSocketListener *aListener) = 0;
  104.  
  105.   /**
  106.      * Returns the port of this server socket.
  107.      */
  108.   /* readonly attribute long port; */
  109.   NS_IMETHOD GetPort(PRInt32 *aPort) = 0;
  110.  
  111.   /**
  112.      * Returns the address to which this server socket is bound.  Since a
  113.      * server socket may be bound to multiple network devices, this address
  114.      * may not necessarily be specific to a single network device.  In the
  115.      * case of an IP socket, the IP address field would be zerod out to
  116.      * indicate a server socket bound to all network devices.  Therefore,
  117.      * this method cannot be used to determine the IP address of the local
  118.      * system.  See nsIDNSService::myHostName if this is what you need.
  119.      */
  120.   /* [noscript] PRNetAddr getAddress (); */
  121.   NS_IMETHOD GetAddress(union PRNetAddr *_retval) = 0;
  122.  
  123. };
  124.  
  125. /* Use this macro when declaring classes that implement this interface. */
  126. #define NS_DECL_NSISERVERSOCKET \
  127.   NS_IMETHOD Init(PRInt32 aPort, PRBool aLoopbackOnly, PRInt32 aBackLog); \
  128.   NS_IMETHOD InitWithAddress(const union PRNetAddr * aAddr, PRInt32 aBackLog); \
  129.   NS_IMETHOD Close(void); \
  130.   NS_IMETHOD AsyncListen(nsIServerSocketListener *aListener); \
  131.   NS_IMETHOD GetPort(PRInt32 *aPort); \
  132.   NS_IMETHOD GetAddress(union PRNetAddr *_retval); 
  133.  
  134. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  135. #define NS_FORWARD_NSISERVERSOCKET(_to) \
  136.   NS_IMETHOD Init(PRInt32 aPort, PRBool aLoopbackOnly, PRInt32 aBackLog) { return _to Init(aPort, aLoopbackOnly, aBackLog); } \
  137.   NS_IMETHOD InitWithAddress(const union PRNetAddr * aAddr, PRInt32 aBackLog) { return _to InitWithAddress(aAddr, aBackLog); } \
  138.   NS_IMETHOD Close(void) { return _to Close(); } \
  139.   NS_IMETHOD AsyncListen(nsIServerSocketListener *aListener) { return _to AsyncListen(aListener); } \
  140.   NS_IMETHOD GetPort(PRInt32 *aPort) { return _to GetPort(aPort); } \
  141.   NS_IMETHOD GetAddress(union PRNetAddr *_retval) { return _to GetAddress(_retval); } 
  142.  
  143. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  144. #define NS_FORWARD_SAFE_NSISERVERSOCKET(_to) \
  145.   NS_IMETHOD Init(PRInt32 aPort, PRBool aLoopbackOnly, PRInt32 aBackLog) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aPort, aLoopbackOnly, aBackLog); } \
  146.   NS_IMETHOD InitWithAddress(const union PRNetAddr * aAddr, PRInt32 aBackLog) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitWithAddress(aAddr, aBackLog); } \
  147.   NS_IMETHOD Close(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Close(); } \
  148.   NS_IMETHOD AsyncListen(nsIServerSocketListener *aListener) { return !_to ? NS_ERROR_NULL_POINTER : _to->AsyncListen(aListener); } \
  149.   NS_IMETHOD GetPort(PRInt32 *aPort) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPort(aPort); } \
  150.   NS_IMETHOD GetAddress(union PRNetAddr *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAddress(_retval); } 
  151.  
  152. #if 0
  153. /* Use the code below as a template for the implementation class for this interface. */
  154.  
  155. /* Header file */
  156. class nsServerSocket : public nsIServerSocket
  157. {
  158. public:
  159.   NS_DECL_ISUPPORTS
  160.   NS_DECL_NSISERVERSOCKET
  161.  
  162.   nsServerSocket();
  163.  
  164. private:
  165.   ~nsServerSocket();
  166.  
  167. protected:
  168.   /* additional members */
  169. };
  170.  
  171. /* Implementation file */
  172. NS_IMPL_ISUPPORTS1(nsServerSocket, nsIServerSocket)
  173.  
  174. nsServerSocket::nsServerSocket()
  175. {
  176.   /* member initializers and constructor code */
  177. }
  178.  
  179. nsServerSocket::~nsServerSocket()
  180. {
  181.   /* destructor code */
  182. }
  183.  
  184. /* void init (in long aPort, in boolean aLoopbackOnly, in long aBackLog); */
  185. NS_IMETHODIMP nsServerSocket::Init(PRInt32 aPort, PRBool aLoopbackOnly, PRInt32 aBackLog)
  186. {
  187.     return NS_ERROR_NOT_IMPLEMENTED;
  188. }
  189.  
  190. /* [noscript] void initWithAddress ([const] in PRNetAddrPtr aAddr, in long aBackLog); */
  191. NS_IMETHODIMP nsServerSocket::InitWithAddress(const union PRNetAddr * aAddr, PRInt32 aBackLog)
  192. {
  193.     return NS_ERROR_NOT_IMPLEMENTED;
  194. }
  195.  
  196. /* void close (); */
  197. NS_IMETHODIMP nsServerSocket::Close()
  198. {
  199.     return NS_ERROR_NOT_IMPLEMENTED;
  200. }
  201.  
  202. /* void asyncListen (in nsIServerSocketListener aListener); */
  203. NS_IMETHODIMP nsServerSocket::AsyncListen(nsIServerSocketListener *aListener)
  204. {
  205.     return NS_ERROR_NOT_IMPLEMENTED;
  206. }
  207.  
  208. /* readonly attribute long port; */
  209. NS_IMETHODIMP nsServerSocket::GetPort(PRInt32 *aPort)
  210. {
  211.     return NS_ERROR_NOT_IMPLEMENTED;
  212. }
  213.  
  214. /* [noscript] PRNetAddr getAddress (); */
  215. NS_IMETHODIMP nsServerSocket::GetAddress(union PRNetAddr *_retval)
  216. {
  217.     return NS_ERROR_NOT_IMPLEMENTED;
  218. }
  219.  
  220. /* End of implementation class template. */
  221. #endif
  222.  
  223.  
  224. /* starting interface:    nsIServerSocketListener */
  225. #define NS_ISERVERSOCKETLISTENER_IID_STR "836d98ec-fee2-4bde-b609-abd5e966eabd"
  226.  
  227. #define NS_ISERVERSOCKETLISTENER_IID \
  228.   {0x836d98ec, 0xfee2, 0x4bde, \
  229.     { 0xb6, 0x09, 0xab, 0xd5, 0xe9, 0x66, 0xea, 0xbd }}
  230.  
  231. class NS_NO_VTABLE nsIServerSocketListener : public nsISupports {
  232.  public: 
  233.  
  234.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISERVERSOCKETLISTENER_IID)
  235.  
  236.   /**
  237.  * nsIServerSocketListener
  238.  *
  239.  * This interface is notified whenever a server socket accepts a new connection.
  240.  * The transport is in the connected state, and read/write streams can be opened
  241.  * using the normal nsITransport API.  The address of the client can be found by
  242.  * calling the nsISocketTransport::GetAddress method or by inspecting
  243.  * nsISocketTransport::GetHost, which returns a string representation of the
  244.  * client's IP address (NOTE: this may be an IPv4 or IPv6 string literal).
  245.  */
  246. /**
  247.      * onSocketAccepted
  248.      *
  249.      * This method is called when a client connection is accepted.
  250.      *
  251.      * @param aServ
  252.      *        The server socket.
  253.      * @param aTransport
  254.      *        The connected socket transport.
  255.      */
  256.   /* void onSocketAccepted (in nsIServerSocket aServ, in nsISocketTransport aTransport); */
  257.   NS_IMETHOD OnSocketAccepted(nsIServerSocket *aServ, nsISocketTransport *aTransport) = 0;
  258.  
  259.   /**
  260.      * onStopListening
  261.      *
  262.      * This method is called when the listening socket stops for some reason.
  263.      * The server socket is effectively dead after this notification.
  264.      *
  265.      * @param aServ
  266.      *        The server socket.
  267.      * @param aStatus
  268.      *        The reason why the server socket stopped listening.  If the
  269.      *        server socket was manually closed, then this value will be
  270.      *        NS_BINDING_ABORTED.
  271.      */
  272.   /* void onStopListening (in nsIServerSocket aServ, in nsresult aStatus); */
  273.   NS_IMETHOD OnStopListening(nsIServerSocket *aServ, nsresult aStatus) = 0;
  274.  
  275. };
  276.  
  277. /* Use this macro when declaring classes that implement this interface. */
  278. #define NS_DECL_NSISERVERSOCKETLISTENER \
  279.   NS_IMETHOD OnSocketAccepted(nsIServerSocket *aServ, nsISocketTransport *aTransport); \
  280.   NS_IMETHOD OnStopListening(nsIServerSocket *aServ, nsresult aStatus); 
  281.  
  282. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  283. #define NS_FORWARD_NSISERVERSOCKETLISTENER(_to) \
  284.   NS_IMETHOD OnSocketAccepted(nsIServerSocket *aServ, nsISocketTransport *aTransport) { return _to OnSocketAccepted(aServ, aTransport); } \
  285.   NS_IMETHOD OnStopListening(nsIServerSocket *aServ, nsresult aStatus) { return _to OnStopListening(aServ, aStatus); } 
  286.  
  287. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  288. #define NS_FORWARD_SAFE_NSISERVERSOCKETLISTENER(_to) \
  289.   NS_IMETHOD OnSocketAccepted(nsIServerSocket *aServ, nsISocketTransport *aTransport) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnSocketAccepted(aServ, aTransport); } \
  290.   NS_IMETHOD OnStopListening(nsIServerSocket *aServ, nsresult aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStopListening(aServ, aStatus); } 
  291.  
  292. #if 0
  293. /* Use the code below as a template for the implementation class for this interface. */
  294.  
  295. /* Header file */
  296. class nsServerSocketListener : public nsIServerSocketListener
  297. {
  298. public:
  299.   NS_DECL_ISUPPORTS
  300.   NS_DECL_NSISERVERSOCKETLISTENER
  301.  
  302.   nsServerSocketListener();
  303.  
  304. private:
  305.   ~nsServerSocketListener();
  306.  
  307. protected:
  308.   /* additional members */
  309. };
  310.  
  311. /* Implementation file */
  312. NS_IMPL_ISUPPORTS1(nsServerSocketListener, nsIServerSocketListener)
  313.  
  314. nsServerSocketListener::nsServerSocketListener()
  315. {
  316.   /* member initializers and constructor code */
  317. }
  318.  
  319. nsServerSocketListener::~nsServerSocketListener()
  320. {
  321.   /* destructor code */
  322. }
  323.  
  324. /* void onSocketAccepted (in nsIServerSocket aServ, in nsISocketTransport aTransport); */
  325. NS_IMETHODIMP nsServerSocketListener::OnSocketAccepted(nsIServerSocket *aServ, nsISocketTransport *aTransport)
  326. {
  327.     return NS_ERROR_NOT_IMPLEMENTED;
  328. }
  329.  
  330. /* void onStopListening (in nsIServerSocket aServ, in nsresult aStatus); */
  331. NS_IMETHODIMP nsServerSocketListener::OnStopListening(nsIServerSocket *aServ, nsresult aStatus)
  332. {
  333.     return NS_ERROR_NOT_IMPLEMENTED;
  334. }
  335.  
  336. /* End of implementation class template. */
  337. #endif
  338.  
  339.  
  340. #endif /* __gen_nsIServerSocket_h__ */
  341.